package cn.iocoder.yudao.module.pinche.dal.mysql.pincorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pinche.dal.dataobject.pincorder.PinCheOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pinche.controller.admin.pincorder.vo.*;

/**
 * 拼车信息 Mapper
 *
 * @author 孙建辉
 */
@Mapper
public interface PinCheOrderMapper extends BaseMapperX<PinCheOrderDO> {

    default PageResult<PinCheOrderDO> selectPage(PinCheOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PinCheOrderDO>()
                .eqIfPresent(PinCheOrderDO::getPcType, reqVO.getPcType())
                .eqIfPresent(PinCheOrderDO::getPcStart, reqVO.getPcStart())
                .eqIfPresent(PinCheOrderDO::getPcDestination, reqVO.getPcDestination())
                .eqIfPresent(PinCheOrderDO::getPcPass, reqVO.getPcPass())
                .betweenIfPresent(PinCheOrderDO::getPcDate, reqVO.getPcDate())
                .eqIfPresent(PinCheOrderDO::getStartTime0, reqVO.getStartTime0())
                .eqIfPresent(PinCheOrderDO::getStartTime1, reqVO.getStartTime1())
                .eqIfPresent(PinCheOrderDO::getStartDeadline, reqVO.getStartDeadline())
                .eqIfPresent(PinCheOrderDO::getCarId, reqVO.getCarId())
                .eqIfPresent(PinCheOrderDO::getLeftSeat, reqVO.getLeftSeat())
                .eqIfPresent(PinCheOrderDO::getConsignAble, reqVO.getConsignAble())
                .eqIfPresent(PinCheOrderDO::getCarType, reqVO.getCarType())
                .eqIfPresent(PinCheOrderDO::getRemark1, reqVO.getRemark1())
                .eqIfPresent(PinCheOrderDO::getRemark2, reqVO.getRemark2())
                .betweenIfPresent(PinCheOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PinCheOrderDO::getId));
    }

    default List<PinCheOrderDO> selectList(PinCheOrderExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PinCheOrderDO>()
                .eqIfPresent(PinCheOrderDO::getPcType, reqVO.getPcType())
                .eqIfPresent(PinCheOrderDO::getPcStart, reqVO.getPcStart())
                .eqIfPresent(PinCheOrderDO::getPcDestination, reqVO.getPcDestination())
                .eqIfPresent(PinCheOrderDO::getPcPass, reqVO.getPcPass())
                .betweenIfPresent(PinCheOrderDO::getPcDate, reqVO.getPcDate())
                .eqIfPresent(PinCheOrderDO::getStartTime0, reqVO.getStartTime0())
                .eqIfPresent(PinCheOrderDO::getStartTime1, reqVO.getStartTime1())
                .eqIfPresent(PinCheOrderDO::getStartDeadline, reqVO.getStartDeadline())
                .eqIfPresent(PinCheOrderDO::getCarId, reqVO.getCarId())
                .eqIfPresent(PinCheOrderDO::getLeftSeat, reqVO.getLeftSeat())
                .eqIfPresent(PinCheOrderDO::getConsignAble, reqVO.getConsignAble())
                .eqIfPresent(PinCheOrderDO::getCarType, reqVO.getCarType())
                .eqIfPresent(PinCheOrderDO::getRemark1, reqVO.getRemark1())
                .eqIfPresent(PinCheOrderDO::getRemark2, reqVO.getRemark2())
                .betweenIfPresent(PinCheOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PinCheOrderDO::getId));
    }

}
